<?php

/*
 * This is  to  create new records.
 */
include '../../include/config.php';
$target_path = '../../storage/' . $_COOKIE['bid'] . '/folders/Records/';
$type = $_POST['type'];
$bid = $_COOKIE['bid'];
$desc = $_POST['desc'];
$date = date('Y-m-d');
$target_path1 = $target_path . basename($_FILES['img']['name']);
$target_path2 = $target_path . basename($_FILES['docs']['name']);
$target_path3 = $target_path . basename($_FILES['videofile']['name']);
/*
 * remaining video validation checking.
 */
if (move_uploaded_file($_FILES['videofile']['tmp_name'], $target_path3)) {
    $video = basename($_FILES['videofile']['name']);
    
} else {
    $video = '';
    echo 'error in video';
}
if (move_uploaded_file($_FILES['img']['tmp_name'], $target_path1)) {
    $image = basename($_FILES['img']['name']);
} else {
    $image = '';
}

if (move_uploaded_file($_FILES['docs']['tmp_name'], $target_path2)) {
    $document = basename($_FILES['docs']['name']);
} else {
    $document = '';
}
mysql_query("insert into baby_user_reports (sr,bid,type,description,image,document,date) value(NULL, $bid, '$type','$desc','$image','$document','$date'  )") or die(mysql_error());
header('Location:../view/Records');




//
//    if (move_uploaded_file($_FILES['docs']['tmp_name'], $target_path1)) {
//        $document = basename($_FILES['docs']['name']);
//        $done = true;
//    }
?>
